From 20bfdf44b30c18eb648382f2d2336597abbf9675 Mon Sep 17 00:00:00 2001 From: robertl Date: Sun, 11 Oct 2009 01:39:19 +0000 Subject: [PATCH] More skytraq changes from Mathias. --- skytraq.c | 28 +++++++++---------- xmldoc/formats/options/skytraq-baud.xml | 8 ++++-- xmldoc/formats/options/skytraq-dump-file.xml | 2 +- xmldoc/formats/options/skytraq-no-output.xml | 2 ++ .../options/skytraq-targetlocation.xml | 5 +++- xmldoc/formats/skytraq.xml | 5 ++-- 6 files changed, 30 insertions(+), 20 deletions(-) create mode 100644 xmldoc/formats/options/skytraq-no-output.xml diff --git a/skytraq.c b/skytraq.c index 607ca4f80..c65221428 100644 --- a/skytraq.c +++ b/skytraq.c @@ -73,10 +73,10 @@ arglist_t skytraq_args[] = { "0", ARGTYPE_BOOL, ARG_NOMINMAX }, { "targetlocation", &opt_set_location, "Set location finder target location as lat,lng", "", ARGTYPE_STRING, "", "" }, + { "baud", &opt_dlbaud, "Baud rate used for download", + "230400", ARGTYPE_INT, "0", "230400" }, { "initbaud", &opt_initbaud, "Baud rate used to init device (0=autodetect)", "0", ARGTYPE_INT, "4800", "230400" }, - { "baud", &opt_dlbaud, "Baud rate used for download", - "230400", ARGTYPE_INT, "4800", "230400" }, { "read-at-once", &opt_read_at_once, "Number of sectors to read at once (0=use single sector mode)", "255", ARGTYPE_INT, "0", "255" }, { "first-sector", &opt_first_sector, "First sector to be read from the device", @@ -85,7 +85,7 @@ arglist_t skytraq_args[] = { "-1", ARGTYPE_INT, "-1", "65535" }, { "dump-file", &opt_dump_file, "Dump raw data to this file", NULL, ARGTYPE_OUTFILE, ARG_NOMINMAX }, - { "no-output", &opt_no_output, "Disable output (useful with e.g. erase or targetlocation)", + { "no-output", &opt_no_output, "Disable output (useful with erase)", "0", ARGTYPE_BOOL, ARG_NOMINMAX }, ARG_TERMINATOR }; @@ -896,10 +896,8 @@ skytraq_read_tracks(void) } } - while (read_at_once > 0 && !(buffer = xmalloc(SECTOR_SIZE*read_at_once+sizeof(SECTOR_READ_END)+6))) { - read_at_once--; - } - if (read_at_once == 0) fatal(MYNAME ": Can't allocate buffer for reading\n"); + buffer = xmalloc(SECTOR_SIZE*read_at_once+sizeof(SECTOR_READ_END)+6); + // m.ad/090930: removed code that tried reducing read_at_once if necessary since doesn't work with xmalloc if (opt_dump_file) { dumpfile = gbfopen(opt_dump_file, "w", MYNAME); @@ -1119,16 +1117,16 @@ skytraq_read(void) { int dlbaud; + if (*opt_set_location) { + skytraq_set_location(); + return; + } + dlbaud = atoi(opt_dlbaud); - if (dlbaud != skytraq_baud) { + if (dlbaud != 0 && dlbaud != skytraq_baud) { skytraq_set_baud(dlbaud); } - if (*opt_set_location) { - skytraq_set_location(); -// return; - } - // read device unless no-output=1 and dump-file=0 (i.e. no data needed at all) if (*opt_no_output == '0' || opt_dump_file != NULL) { skytraq_read_tracks(); @@ -1138,7 +1136,9 @@ skytraq_read(void) skytraq_erase(); } - skytraq_set_baud(skytraq_baud); // note that _system_restart resets baud rate anyway... + if (dlbaud != 0 && dlbaud != skytraq_baud) { + skytraq_set_baud(skytraq_baud); // note that _system_restart resets baud rate anyway... + } skytraq_system_restart(); } diff --git a/xmldoc/formats/options/skytraq-baud.xml b/xmldoc/formats/options/skytraq-baud.xml index 91f4f219a..e250cd78d 100644 --- a/xmldoc/formats/options/skytraq-baud.xml +++ b/xmldoc/formats/options/skytraq-baud.xml @@ -1,3 +1,7 @@ The following baud rates can be used: 4800, 9600, 19200, 38400, 57600, 115200, 230400. -Note that your logger might support only a subset of them (especially 230400 which isn't documented -in the chipset manual, though there are devices that are capable of this speed). +Note that your logger might not support all of them (especially 230400 which isn't documented +in the chipset manual, though there are known devices that are capable of this speed). + +If baud=0 (zero) download takes place at the baud rate the +device is currently set to. This is especially useful for Bluetooth connections since they +often don't allow changing the baud rate. diff --git a/xmldoc/formats/options/skytraq-dump-file.xml b/xmldoc/formats/options/skytraq-dump-file.xml index 52bb28929..b3323d92b 100644 --- a/xmldoc/formats/options/skytraq-dump-file.xml +++ b/xmldoc/formats/options/skytraq-dump-file.xml @@ -1,3 +1,3 @@ Writes raw data as it is read from the logger to the file given as this option's argument -(additional to decoding it as usual). The binary files can be read and decoded by skytraq-bin format. +(additional to decoding it as usual). The resulting binary files can be read and decoded by the skytraq-bin format. Mainly useful for debugging/development purposes. diff --git a/xmldoc/formats/options/skytraq-no-output.xml b/xmldoc/formats/options/skytraq-no-output.xml new file mode 100644 index 000000000..482aa8c17 --- /dev/null +++ b/xmldoc/formats/options/skytraq-no-output.xml @@ -0,0 +1,2 @@ +If this option is given, no GPS log data will be read from the device +(unless "dump-file" is given too; in that case only decoding will be disabled). diff --git a/xmldoc/formats/options/skytraq-targetlocation.xml b/xmldoc/formats/options/skytraq-targetlocation.xml index 77d5f2746..a132e2ce8 100644 --- a/xmldoc/formats/options/skytraq-targetlocation.xml +++ b/xmldoc/formats/options/skytraq-targetlocation.xml @@ -2,13 +2,16 @@ The device provides a location finder built from eight LEDs and can use those LEDs to guide you to a location. You can set the target location with the 'targetlocation' option. Use ':' as the delimiter between latitude - and longitude. + and longitude. Note that GPSBabel terminates after writing the location info + to the device, i.e. no logging data will be read from it. Set the target location of the Skytraq location finder gpsbabel -i skytraq,targetlocation=12.34:-56.78 -f /dev/ttyUSB 0 -o unicsv -F - + + Sets latitude and longitude of the location finder to N12.34 and W56.78 respectively. The arrows on the device will point you to this location as soon as diff --git a/xmldoc/formats/skytraq.xml b/xmldoc/formats/skytraq.xml index 0013e3868..cbdab39aa 100644 --- a/xmldoc/formats/skytraq.xml +++ b/xmldoc/formats/skytraq.xml @@ -69,9 +69,10 @@ use this format to read its memory. If available, reading the logger using bluetooth should also work. However, many devices support only one -specific baud rate over bluetooth, e.g. 9600: +specific baud rate over bluetooth, e.g. 9600. In that case you should use the option baud=0 +to tell GPSBabel to use that default baud rate: Command showing skytraq download tracks via bluetooth on Linux rfcomm bind 0 <bdaddr> - gpsbabel -i skytraq,baud=9600 -f /dev/rfcomm0 -o gpx -F out.gpx + gpsbabel -i skytraq,baud=0 -f /dev/rfcomm0 -o gpx -F out.gpx -- 2.30.2